package com.savitar.common.vo;

import cn.hutool.http.HttpStatus;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultBean implements Serializable {
    private Integer code;
    private String message;
    private Object result;


    public static ResultBean ok(Object obj) {
        return ok(null, obj);
    }

    public static ResultBean ok(String message, Object obj) {
        return new ResultBean(HttpStatus.HTTP_OK, message, obj);
    }

    public static ResultBean err(Integer code, String message) {
        return new ResultBean(code, message, null);
    }

    public static ResultBean err(String message) {
        return err(-1, message);
    }
}
